﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;

namespace MyEconomy.Data
{
    protected class SessionFactory
    {
        private static ISessionFactory _sessionFactory;

        public static ISessionFactory Current
        { 
            get
            {
                if (_sessionFactory == null)
                {
                    var configuration = new Configuration();
                    configuration.Configure("NHibernateConfig.xml");
                    _sessionFactory = configuration.BuildSessionFactory();
                }

                return _sessionFactory;
            }
        }
        
    }
}
